import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Header from '../views/Header.vue'
import Goods  from '../views/Goods.vue'
import About from '../views/About.vue'
import Detail from '../views/Details.vue'
import Cart from '../views/Cart.vue'
import Order from '../views/Order.vue'
import Collect from '../views/Collect.vue'
import ConfirmOrder from '../views/ConfirmOrder.vue'

Vue.use(VueRouter)

const routes = [
  {
    name:'header',
    path:'/',
    component:Header,
    redirect: '/home',
    children:[
      {
        name:'home',
        path:'home',
        component:Home
      },
      {
        name:'goods',
        path:'goods',
        component:Goods
      },
      {
        name:'about',
        path:'about',
        component:About
      },
      {
        name:'details',
        path:'details',
        component:Detail
      },
      {
        name:'cart',
        path:'cart',
        component:Cart,
        meta:{isAuth:true,title:'购物车'}
      },
      {
        name:'order',
        path:'order',
        component:Order,
        meta:{isAuth:true,title:'订单'}
      },
      {
        name:'collect',
        path:'collect',
        component:Collect,
        meta:{isAuth:true,title:'收藏'}
      },
      {
        name:'confirmOrder',
        path:'confirmOrder',
        component:ConfirmOrder
      }
    ]
  },
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
